<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<html>
<head>
    <script type="text/javascript">

        $(function(){
            $.ajax({
                type: 'POST',
                url: "../channelinf/getChannelByTp.do?chn_tp=1",
                success: function(data) {
                    var msg = [];
                    msg.push({ "id": "", "text": "---请选择---" });
                    for(var i=0;i<data.length;i++){
                        msg.push({ "id": data[i].ID, "text": data[i].TEXT });
                    }
                    $("#channel_no").combobox({
                        data:msg,
                        valueField:'id',
                        textField:'text',
                        panelHeight:'auto',
                        onLoadSuccess:function(param){
                            var channel_no="";
                            if(param.length>0){
                                channel_no=param[0].id;
                            }
                        }
                    });
                }
            });
            //加载业务名称数据
            $('#service_uuid').combobox({
                url:"../serviceParam/getAllService.do",
                valueField:'SERVICE_UUID',
                textField:'SERVICE_NAME',
                editable:false,
                onChange:function(record){
                    var value = $('#service_uuid').combobox('getValue');
                    loadServiceParamsInf(value);
                }
            });

            $("#service_param_uuid").combobox({
                onShowPanel : function () {
                    if($("input[name='service_uuid']").val() == '' || $("input[name='service_uuid']").prev().val() == ''){
                        $.jpmessage.warning("请先选择业务名称！");
                        $(this).combo('hidePanel', true);
                    }
                }
            });

        });
        
        /**
         *点击业务的时候载入业务参数数据
         */
        function loadServiceParamsInf(value) {
            $('#service_param_uuid').combobox('clear');
            $('#service_param_uuid').combobox('reload',
                '../serviceParam/getAllServiceParams.do?service_uuid=' + value)
        }
        
        function doSearch() {
        	grid.load({
                channel_no: $('#channel_no').val(),
                service_uuid: $('#service_uuid').val(),
                service_param_uuid: $('#service_param_uuid').val()
            });
        }

        function addChnServiceCost(url){
            commonDetail(url,"save","chnServiceCostTableId");
        }
        function modifyChnServiceCost(url){
            commonDetail(url,"update","chnServiceCostTableId");
        }
       var grid;
        $(document).ready(function() {
        	grid = $("#chnServiceCostTableId").jpgrid({
                url: "ChnServiceCostListJson.do",
                columns: [
                    {title: "通道编号", field: "CHANNEL_NM"},
                    {title: "业务参数名称", field: "SERVICE_NM"},
                    {title: "业务名称", field: "PARAM_NM"},
                    {title: "贷记卡扣率", field: "CREDIT_RATE"},
                    {title: "贷记卡附加手续费", field: "CREDIT_ATTACHFEE"},
                    {title: "贷记卡最小手续费", field: "CREDIT_MINFEE"},
                    {title: "贷记卡最大手续费", field: "CREDIT_MAXFEE"},
                ]
            });
        });
    </script>
</head>

<body class="easyui-layout list_body"  >
	<form id="chnServiceCostForm" name="chnServiceCostForm">
		<div class="list_body_north" data-options="region:'north'"  border="false" >
			<!-- 查询表单 -->
			<div  class="datagrid-toolbar" border="false"  >
				<span>通道编号:</span>
            <input id="channel_no" type="text" name="channel_no"  class="easyui-textbox"  >
            <span>业务名称:</span>
            <input id="service_uuid" type="text" name="service_uuid"  class="easyui-textbox"  >
            <span>业务参数名称:</span>
            <input class="easyui-combobox" type="text" name="service_param_uuid" id="service_param_uuid"
                   data-options="valueField:'SERVICE_PARAM_UUID', textField:'PARAM_NAME',editable:false," >
            
            <a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch() ">查询</a>
            <a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm() ">重置</a>
			</div>
			<!-- 自定义标签工具栏 -->
			<jiepos:buttonOperateTag menuCode="${menuCode}"></jiepos:buttonOperateTag>	
		</div>
		<div data-options="region:'center'" border="false"  class="list_body_center">		
			<!-- 表格 -->
			<table id="chnServiceCostTableId" fit="true"></table>
		</div>
	</form>
</body>
</html>
